#ifndef CHARACTER_H
#define CHARACTER_H

#include "algebra3.h"
#include "model.h"
#include "engine.h"


class Character{
public:
	Model myModel;
	vec3 pos;
	bool alive;
	
	Character(){
		myModel = getInput("Magic.obj");
		pos = vec3(0,0,0);
		alive = true;
	}
	
	void draw(){
		float timeElapsed =  (glutGet(GLUT_ELAPSED_TIME) * -1) /150000;
		computeDistance(timeElapsed);

		if (alive && pos[2] < 5.0){
			glPushMatrix();
			glTranslatef(pos[0], computeHeight(), pos[2]);
			cout << pos << endl;
			myModel.draw();
			glPopMatrix();
		}
		else{
			alive = false;
		}
	}
	
	float computeHeight(){
		pos[1] = pos[1] - .01;
		return sin(pos[1]) + 1;
	}
	
	void computeDistance(float time){
		pos[2] =  pos[2] - time * 5;
	}
};

#endif